﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Runtime.Serialization;
using System.Text;
using System.Threading.Tasks;

namespace InstantSpine.Core
{
    [DataContract]
    public abstract class MaterialViewModel : INotifyPropertyChanged
    {
        public event PropertyChangedEventHandler PropertyChanged;

        private string name;
        /// <summary>
        /// Descriptive name of the material
        /// </summary>
        [DataMember]
        public string Name {
            get { return name; }
            set {
                if (name != value) {
                    name = value;
                    OnPropertyChanged();
                    //PropertyChanged.Raise(this);
                }
            }
        }

        protected void OnPropertyChanged([CallerMemberName] string propertyName = "") {
            if (PropertyChanged != null)
                PropertyChanged.Invoke(this, new PropertyChangedEventArgs(propertyName));
        }

        protected MaterialViewModel(string name) {
            this.name = name;
        }
    }
}
